package com.cod.render.shapes;

import javax.microedition.khronos.opengles.GL10;

public class Light {

	float[] lightColor = { 1, 1, 1, 1 };
	float[] ambientLightColor = { 0.2f, 0.2f, 0.2f, 1 };
	Cube cube;

	public Light() {
		cube = new Cube(0.1f);
	}

	public void draw(GL10 gl) {
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, ambientLightColor, 0);
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, lightColor, 0);
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, lightColor, 0);
		gl.glEnable(GL10.GL_LIGHTING);
		gl.glEnable(GL10.GL_LIGHT0);
		float[] direction = { 1 / (float) Math.sqrt(2),
				1 / (float) Math.sqrt(2), 0, 0 };
		gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, direction, 0);
		gl.glEnable(GL10.GL_COLOR_MATERIAL);
		cube.draw(gl);
	}
}
